package org.tgcloud.group.web.controller.manager;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.*;
import org.tgcloud.group.core.APPResultMessage;
import org.tgcloud.group.core.custom.Permissions;
import org.tgcloud.group.core.session.Session;
import org.tgcloud.group.service.manager.MediaPartyManageService;
import org.tgcloud.group.web.controller.dto.meidaParty.MediaPartyDTO;
import org.tgcloud.group.web.controller.req.mediaParty.MediaPartyAddReq;
import org.tgcloud.group.web.controller.req.mediaParty.MediaPartyIdReq;
import org.tgcloud.group.web.controller.req.mediaParty.MediaPartySearchReq;
import org.tgcloud.group.web.controller.req.mediaParty.MediaPartyUpdateReq;
import org.tgcloud.group.web.controller.req.user.ManageUserAddReq;

import java.util.Date;

/**
 * @Author: zhy
 * @Created: 2025-08-25-下午5:51
 * @Description:
 */
@Api(tags = "媒体方管理相关接口")
@RestController
@RequestMapping("/manager/pc/user")
@EnableAutoConfiguration
public class MediaPartyManageController extends ManageAPPBaseController{

    @Autowired
    private MediaPartyManageService mediaPartyManageService;

//    @Permissions("mediaParty:view")
    @ApiOperation(value = "媒体方列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string"),
    })
    @ResponseBody
    @RequestMapping(value = "/getMediaPartyList", method = RequestMethod.POST)
    public APPResultMessage<Object, MediaPartyDTO> getMediaPartyList(@ModelAttribute("session") Session session,
                                                                     @RequestBody MediaPartySearchReq req) {
        return mediaPartyManageService.getMediaPartyList(req.getPageNum(),req.getPageSize(),req.getKeyword());
    }



    @Permissions("mediaParty:add")
    @ApiOperation(value = "媒体方:新增")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string"),
    })
    @ResponseBody
    @RequestMapping(value = "/doAddMediaParty", method = RequestMethod.POST)
    public APPResultMessage doAddMediaParty(@ModelAttribute("session") Session session,
                                            @RequestBody MediaPartyAddReq req) {
        return mediaPartyManageService.doAddMediaParty(req);
    }



    @Permissions("mediaParty:update")
    @ApiOperation(value = "媒体方:修改")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string"),
    })
    @ResponseBody
    @RequestMapping(value = "/doUpdateMediaParty", method = RequestMethod.POST)
    public APPResultMessage doUpdateMediaParty(@ModelAttribute("session") Session session,
                                               @RequestBody MediaPartyUpdateReq req) {
        return mediaPartyManageService.doUpdateMediaParty(req);
    }



    @Permissions("mediaParty:del")
    @ApiOperation(value = "媒体方:删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string"),
    })
    @ResponseBody
    @RequestMapping(value = "/doDelMediaParty", method = RequestMethod.POST)
    public APPResultMessage doDelMediaParty(@ModelAttribute("session") Session session,
                                            @RequestBody MediaPartyIdReq req) {
        return mediaPartyManageService.doDelMediaParty(req);
    }


}
